/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package colloque.servlets;

import colloque.HibernateUtil;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;

/**
 *
 * @author James
 */
public class ClearCache extends HttpServlet {

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Session session;
        session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        session.clear();
        session.flush();
        this.getServletContext().getRequestDispatcher("/jsp/connexion.jsp").forward(request, response);
    }
}
